import React from 'react'
import { useNavigate, useInRouterContext } from 'react-router-dom'

export default function Header() {
  console.log(useInRouterContext())
  const navigate = useNavigate();

  function back() {
    navigate(-1)
  }

  function go() {
    navigate(1)
  }

  return (
    <div className="col-xs-8 col-md-8 col-lg-8 offset-xs-2 offset-md-2 offset-lg-2">
      <div className="page-header">
        <h2>React Router Demo</h2>
        <button onClick={back}>←后退</button>
        <button onClick={go}>前进→</button>
      </div>
    </div>
  )
}
